package day021.homework.p5;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class TcpServer {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(9999);

        Socket server = ss.accept();
        System.out.println("客户端连接成功");
        InputStream netInput = server.getInputStream();
        byte[] buf = new byte[1024];
        int len = netInput.read(buf);
        System.out.println("客户端发送的数据=" + new String(buf, 0, len));

        server.close();
        ss.close();
    }
}
